# 增强request response 获取参数方式统一 提供status 提供认证 权限 限流
from rest_framework.views import APIView
# mixins提供5个ModelMixin增删改查基本方法
# GenericAPIView 提供基本属性和方法 给 mixins分别结合生成9个子类
from rest_framework.mixins import CreateModelMixin
from rest_framework.generics import GenericAPIView, CreateAPIView, ListCreateAPIView
# ViewSetMixin重写as_view的action方法，与APIView结合ViewSet；与GenericAPIView结合成GenericViewSet
# GenericViewSet再与 mixins的5个Model的基本方法结合成ModelViewSet或ReadOnlyModelViewSet，或自定义组合
from rest_framework.viewsets import GenericViewSet

from users.models import User
from .serializers import UserSerializer
from utils.logger import getLogger

logger = getLogger('users')


class MyView(ListCreateAPIView):
    """用户类视图文件"""
    queryset = User.objects.all()
    serializer_class = UserSerializer
    # permission_classes = []
